import { Typography as ATypography } from 'antd';
import cls from 'classnames';
import React from 'react';
import Style from './index.module.less';
const { Text, Link } = ATypography;
/**
 * 通用文本组件 替代antd的Typography
 * 规范文本样式
*/
export const Typography = React.memo((props) => {
    const { as, useBold, color, className, style, link, type = 'default', hideEditIcon, ...rest } = props;
    const getBold = () => {
        return useBold;
    };
    const bold = getBold();
    const resolveType = link ? 'primary' : type;
    const commonProps = {
        style: color ? { ...style, color } : style,
        className: cls(Style['typography-text'], Style[`typography-type-${resolveType}`], Style[`typography-text-${as || 's2'}`], bold ? Style['typography-text-bold'] : '', className || '')
    };
    if (link) {
        return (<Link {...commonProps} {...link} children={rest.children}/>);
    }
    return (<Text {...rest} {...commonProps}/>);
});
export default Typography;
